import axios from '@/utils/request';

/**
 * 组织架构中新增公司信息
 */
 export async function AddCompany(params) {
    const res = await axios.post('/Company/AddCompany',params);
    if (res.data.code === 200) {
        return res.data.msg;
    }
    return Promise.reject(new Error(res.data.msg));
}

/**
 * 组织架构中修改公司信息
 */
 export async function UpdateCompany(params) {
    const res = await axios.post('/Company/UpdateCompany',params);
    if (res.data.code === 200) {
        return res.data.msg;
    }
    return Promise.reject(new Error(res.data.msg));
}

  /**
 * 根据id删除当前公司组织架构
 */
   export async function DeleteCompany(id) {
    const res = await axios.get('/Company/DeleteCompany/'+id);
    if (res.data.code === 200) {
      return res.data.msg;
    }
    return Promise.reject(new Error(res.data.msg));
  }
  
  
/**
 * 查询当前公司信息
 */
 export async function QueryCurrentCompany() {
    const res = await axios.get('/Company/GetAllModels');
    if (res.data.code === 200) {
      return res.data.data[0];
    }
    return Promise.reject(new Error(res.data.msg));
  }